<script setup lang="ts">
import { reactive } from 'vue';
import { useRoute } from "vue-router";
import {getNewsDetailData} from "@/api/news";
const route = useRoute();
const currentID = route.params?.id ?? -1;

let initData:any = reactive({
  data:{}
});
// 获取初始化详情信息
function getInitData(currentID){
  getNewsDetailData({id:currentID},{config:{showLoading:true,loadingStyle:{lock:false,text:"加载中...",background:'rgba(255,255,255,.7)'}}}).then((res:any)=>{
    if(res.data){
      initData.data = res.data;
      console.log(initData);
    }
  });
}

getInitData(currentID);
</script>
<template>
  <div class="news-detail-page">
    <h1>{{initData.data.title}}</h1>
    <div v-html="initData.data.content"></div>
  </div>
</template>

<style>
</style>